/*
 * jopengl_GL.cpp
 *
 *  Created on: 2013-7-22
 *      Author: pan.jinghua
 */

#include <windows.h>
#include <stdio.h>
#include <GL/gl.h>

#include "jopengl_GL.h"

#define gbv(jba, bv) GLbyte* bv = (GLbyte*)env->GetByteArrayElements(jba, 0)
#define rbv(jba, bv) env->ReleaseByteArrayElements(jba, (jbyte*)bv, 0)
#define gubv(jba, bv) GLubyte* bv = (GLubyte*)env->GetByteArrayElements(jba, 0)

#define gfv(jfa, fv) GLfloat* fv = (GLfloat*)env->GetFloatArrayElements(jfa, 0)
#define rfv(jfa, fv) env->ReleaseFloatArrayElements(jfa, (jfloat*)fv, 0)

#define gdv(jda, dv) GLdouble* dv = (GLdouble*)env->GetDoubleArrayElements(jda, 0)
#define rdv(jda, dv) env->ReleaseDoubleArrayElements(jda, (jdouble*)dv, 0)

#define giv(jia, iv) GLint* iv = (GLint*)env->GetIntArrayElements(jia, 0)
#define riv(jia, iv) env->ReleaseIntArrayElements(jia, (jint*)iv, 0)
#define guiv(jia, iv) GLuint* iv = (GLuint*)env->GetIntArrayElements(jia, 0)

#define gsv(jsa, sv) GLshort* sv = (GLshort*)env->GetShortArrayElements(jsa, 0)
#define rsv(jsa, sv) env->ReleaseShortArrayElements(jsa, (jshort*)sv, 0)
#define gusv(jsa, sv) GLushort* sv = (GLushort*)env->GetShortArrayElements(jsa, 0)

#define gzv(jza, zv) GLboolean* zv = env->GetBooleanArrayElements(jza, 0)
#define rzv(jza, zv) env->ReleaseBooleanArrayElements(jza, (jboolean*)zv, 0)

void JNICALL Java_jopengl_GL_glClearIndex
  (JNIEnv *env, jclass clz, jfloat c) {
    glClearIndex(c);
}

void JNICALL Java_jopengl_GL_glClearColor
  (JNIEnv *env, jclass clz, jfloat red, jfloat green, jfloat blue, jfloat alpha) {
    glClearColor(red, green, blue, alpha);
}

void JNICALL Java_jopengl_GL_glClear
  (JNIEnv *env, jclass clz, jint mask) {
    glClear(mask);
}

void JNICALL Java_jopengl_GL_glIndexMask
  (JNIEnv *env, jclass clz, jint mask) {
    glIndexMask(mask);
}

void JNICALL Java_jopengl_GL_glColorMask
  (JNIEnv *env, jclass clz, jboolean red, jboolean green, jboolean blue, jboolean alpha) {
    glColorMask(red, green, blue, alpha);
}

void JNICALL Java_jopengl_GL_glAlphaFunc
  (JNIEnv *env, jclass clz, jint func, jfloat ref) {
    glAlphaFunc(func, ref);
}

void JNICALL Java_jopengl_GL_glBlendFunc
  (JNIEnv *env, jclass clz, jint sfactor, jint dfactor) {
    glBlendFunc(sfactor, dfactor);
}

void JNICALL Java_jopengl_GL_glLogicOp
  (JNIEnv *env, jclass clz, jint opcode) {
    glLogicOp(opcode);
}

void JNICALL Java_jopengl_GL_glCullFace
  (JNIEnv *env, jclass clz, jint mode) {
    glCullFace(mode);
}

void JNICALL Java_jopengl_GL_glFrontFace
  (JNIEnv *env, jclass clz, jint mode) {
    glFrontFace(mode);
}

void JNICALL Java_jopengl_GL_glPointSize
  (JNIEnv *env, jclass clz, jfloat size) {
    glPointSize(size);
}

void JNICALL Java_jopengl_GL_glLineWidth
  (JNIEnv *env, jclass clz, jfloat width) {
    glLineWidth(width);
}

void JNICALL Java_jopengl_GL_glLineStipple
  (JNIEnv *env, jclass clz, jint factor, jshort pattern) {
    glLineStipple(factor, pattern);
}

void JNICALL Java_jopengl_GL_glPolygonMode
  (JNIEnv *env, jclass clz, jint face, jint mode) {
    glPolygonMode(face, mode);
}

void JNICALL Java_jopengl_GL_glPolygonOffset
  (JNIEnv *env, jclass clz, jfloat factor, jfloat units) {
    glPolygonOffset(factor, units);
}

void JNICALL Java_jopengl_GL_glPolygonStipple
  (JNIEnv *env, jclass clz, jbyteArray mask) {
    gubv(mask, bv);
    glPolygonStipple(bv);
    rbv(mask, bv);
}

jbyteArray JNICALL Java_jopengl_GL_glGetPolygonStipple
  (JNIEnv *env, jclass clz) {
    jbyteArray mask = env->NewByteArray(128);
    gubv(mask, bv);
    glGetPolygonStipple(bv);
    env->SetByteArrayRegion(mask, 0, 128, (jbyte*)bv);
    rbv(mask, bv);
    return mask;
}

void JNICALL Java_jopengl_GL_glEdgeFlag__Z
  (JNIEnv *env, jclass clz, jboolean flag) {
    glEdgeFlag(flag);
}

void JNICALL Java_jopengl_GL_glEdgeFlag___3Z
  (JNIEnv *env, jclass clz, jbooleanArray flag) {
    gzv(flag, zv);
    glEdgeFlagv(zv);
    rzv(flag, zv);
}

void JNICALL Java_jopengl_GL_glScissor
  (JNIEnv *env, jclass clz, jint x, jint y, jint width, jint height) {
    glScissor(x, y, width, height);
}

void JNICALL Java_jopengl_GL_glClipPlane
  (JNIEnv *env, jclass clz, jint plane, jdoubleArray equation) {
    gdv(equation, dv);
    glClipPlane(plane, dv);
    rdv(equation, dv);
}

jdoubleArray JNICALL Java_jopengl_GL_glGetClipPlane
  (JNIEnv *env, jclass clz, jint plane) {
    jdoubleArray equation = env->NewDoubleArray(4);
    gdv(equation, dv);
    glGetClipPlane(plane, dv);
    env->SetDoubleArrayRegion(equation, 0, 4, dv);
    rdv(equation, dv);
    return equation;
}

void JNICALL Java_jopengl_GL_glDrawBuffer
  (JNIEnv *env, jclass clz, jint mode) {
    glDrawBuffer(mode);
}

void JNICALL Java_jopengl_GL_glReadBuffer
  (JNIEnv *env, jclass clz, jint mode) {
    glReadBuffer(mode);
}

void JNICALL Java_jopengl_GL_glEnable
  (JNIEnv *env, jclass clz, jint cap) {
    glEnable(cap);
}

void JNICALL Java_jopengl_GL_glDisable
  (JNIEnv *env, jclass clz, jint cap) {
    glDisable(cap);
}

jboolean JNICALL Java_jopengl_GL_glIsEnabled
  (JNIEnv *env, jclass clz, jint cap) {
    return glIsEnabled(cap);
}

void JNICALL Java_jopengl_GL_glEnableClientState
  (JNIEnv *env, jclass clz, jint cap) {
    glEnableClientState(cap);
}

void JNICALL Java_jopengl_GL_glDisableClientState
  (JNIEnv *env, jclass clz, jint cap) {
    glDisableClientState(cap);
}

jbooleanArray JNICALL Java_jopengl_GL_glGetBoolean
  (JNIEnv *env, jclass clz, jint pname, jbooleanArray params) {
    gzv(params, zv);
    glGetBooleanv(pname, zv);
    rzv(params, zv);
    return params;
}

jdoubleArray JNICALL Java_jopengl_GL_glGetDouble
  (JNIEnv *env, jclass clz, jint pname, jdoubleArray params) {
     gdv(params, dv);
     glGetDoublev(pname, dv);
     rdv(params, dv);
     return params;
 }

jfloatArray JNICALL Java_jopengl_GL_glGetFloat
  (JNIEnv *env, jclass clz, jint pname, jfloatArray params) {
    gfv(params, fv);
    glGetFloatv(pname, fv);
    rfv(params, fv);
    return params;
}

jintArray JNICALL Java_jopengl_GL_glGetInteger
  (JNIEnv *env, jclass clz, jint pname, jintArray params) {
    giv(params, iv);
    glGetIntegerv(pname, iv);
    riv(params, iv);
    return params;
}

void JNICALL Java_jopengl_GL_glPushAttrib
  (JNIEnv *env, jclass clz, jint mask) {
    glPushAttrib(mask);
}

void JNICALL Java_jopengl_GL_glPopAttrib
  (JNIEnv *env, jclass clz) {
    glPopAttrib();
}

void JNICALL Java_jopengl_GL_glPushClientAttrib
  (JNIEnv *env, jclass clz, jint mask) {
    glPushClientAttrib(mask);
}

void JNICALL Java_jopengl_GL_glPopClientAttrib
  (JNIEnv *env, jclass clz) {
    glPopClientAttrib();
}

jint JNICALL Java_jopengl_GL_glRenderMode
  (JNIEnv *env, jclass clz, jint mode) {
    return glRenderMode(mode);
}

jint JNICALL Java_jopengl_GL_glGetError
  (JNIEnv *env, jclass clz) {
    return glGetError();
}

jstring JNICALL Java_jopengl_GL_glGetString
  (JNIEnv *env, jclass clz, jint name) {
    return env->NewStringUTF((char*)glGetString(name));
}

void JNICALL Java_jopengl_GL_glFinish
  (JNIEnv *env, jclass clz) {
    glFinish();
}

void JNICALL Java_jopengl_GL_glFlush
  (JNIEnv *env, jclass clz) {
    glFlush();
}

void JNICALL Java_jopengl_GL_glHint
  (JNIEnv *env, jclass clz, jint target, jint mode) {
    glHint(target, mode);
}

void JNICALL Java_jopengl_GL_glClearDepth
  (JNIEnv *env, jclass clz, jdouble depth) {
    glClearDepth(depth);
}

void JNICALL Java_jopengl_GL_glDepthFunc
  (JNIEnv *env, jclass clz, jint func) {
    glDepthFunc(func);
}

void JNICALL Java_jopengl_GL_glDepthMask
  (JNIEnv *env, jclass clz, jboolean flag) {
    glDepthMask(flag);
}

void JNICALL Java_jopengl_GL_glDepthRange
  (JNIEnv *env, jclass clz, jdouble near_val, jdouble far_val) {
    glDepthRange(near_val, far_val);
}

void JNICALL Java_jopengl_GL_glClearAccum
  (JNIEnv *env, jclass clz, jfloat red, jfloat green, jfloat blue, jfloat alpha) {
    glClearAccum(red, green, blue, alpha);
}

void JNICALL Java_jopengl_GL_glAccum
  (JNIEnv *env, jclass clz, jint op, jfloat value) {
    glAccum(op, value);
}

void JNICALL Java_jopengl_GL_glMatrixMode
  (JNIEnv *env, jclass clz, jint mode) {
    glMatrixMode(mode);
}

void JNICALL Java_jopengl_GL_glOrtho
  (JNIEnv *env, jclass clz, jdouble left, jdouble right, jdouble bottom, jdouble top, jdouble near_val, jdouble far_val) {
    glOrtho(left, right, bottom, top, near_val, far_val);
}

void JNICALL Java_jopengl_GL_glFrustum
  (JNIEnv *env, jclass clz, jdouble left, jdouble right, jdouble bottom, jdouble top, jdouble near_val, jdouble far_val) {
    glFrustum(left, right, bottom, top, near_val, far_val);
}

void JNICALL Java_jopengl_GL_glViewport
  (JNIEnv *env, jclass clz, jint x, jint y, jint width, jint height) {
    glViewport(x, y, width, height);
}

void JNICALL Java_jopengl_GL_glPushMatrix
  (JNIEnv *env, jclass clz) {
    glPushMatrix();
}

void JNICALL Java_jopengl_GL_glPopMatrix
  (JNIEnv *env, jclass clz) {
    glPopMatrix();
}

void JNICALL Java_jopengl_GL_glLoadIdentity
  (JNIEnv *env, jclass clz) {
    glLoadIdentity();
}

void JNICALL Java_jopengl_GL_glLoadMatrix___3D
  (JNIEnv *env, jclass clz, jdoubleArray m) {
    gdv(m, dv);
    glLoadMatrixd(dv);
    rdv(m, dv);
}

void JNICALL Java_jopengl_GL_glLoadMatrix___3F
  (JNIEnv *env, jclass clz, jfloatArray m) {
    gfv(m, fv);
    glLoadMatrixf(fv);
    rfv(m, fv);
}

void JNICALL Java_jopengl_GL_glMultMatrix___3D
  (JNIEnv *env, jclass clz, jdoubleArray m) {
    gdv(m, dv);
    glMultMatrixd(dv);
    rdv(m, dv);
}

void JNICALL Java_jopengl_GL_glMultMatrix___3F
  (JNIEnv *env, jclass clz, jfloatArray m) {
    gfv(m, fv);
    glMultMatrixf(fv);
    rfv(m, fv);
}

JNIEXPORT void JNICALL Java_jopengl_GL_glRotate__DDDD
  (JNIEnv *env, jclass clz, jdouble angle, jdouble x, jdouble y, jdouble z) {
    glRotated(angle, x, y, z);
}

JNIEXPORT void JNICALL Java_jopengl_GL_glRotate__FFFF
  (JNIEnv *env, jclass clz, jfloat angle, jfloat x, jfloat y, jfloat z) {
    glRotatef(angle, x, y, z);
}

JNIEXPORT void JNICALL Java_jopengl_GL_glScale__DDD
  (JNIEnv *env, jclass clz, jdouble x, jdouble y, jdouble z) {
    glScaled(x, y, z);
}

JNIEXPORT void JNICALL Java_jopengl_GL_glScale__FFF
  (JNIEnv *env, jclass clz, jfloat x, jfloat y, jfloat z) {
    glScalef(x, y, z);
}

JNIEXPORT void JNICALL Java_jopengl_GL_glTranslate__DDD
  (JNIEnv *env, jclass clz, jdouble x, jdouble y, jdouble z) {
    glTranslated(x, y, z);
}

JNIEXPORT void JNICALL Java_jopengl_GL_glTranslate__FFF
  (JNIEnv *env, jclass clz, jfloat x, jfloat y, jfloat z) {
    glTranslatef(x, y, z);
}

jboolean JNICALL Java_jopengl_GL_glIsList
  (JNIEnv *env, jclass clz, jint list) {
    return glIsList(list);
}

void JNICALL Java_jopengl_GL_glDeleteLists
  (JNIEnv *env, jclass clz, jint list, jint range) {
    glDeleteLists(list, range);
}

jint JNICALL Java_jopengl_GL_glGenLists
  (JNIEnv *env, jclass clz, jint range) {
    return glGenLists(range);
}

void JNICALL Java_jopengl_GL_glNewList
  (JNIEnv *env, jclass clz, jint list, jint mode) {
    glNewList(list, mode);
}

void JNICALL Java_jopengl_GL_glEndList
  (JNIEnv *env, jclass clz) {
    glEndList();
}

void JNICALL Java_jopengl_GL_glCallList
  (JNIEnv *env, jclass clz, jint list) {
    glCallList(list);
}

void JNICALL Java_jopengl_GL_glCallLists
  (JNIEnv *env, jclass clz, jintArray lists) {
    giv(lists, iv);
    glCallLists(env->GetArrayLength(lists), GL_INT, iv);
    riv(lists, iv);
}

void JNICALL Java_jopengl_GL_glListBase
  (JNIEnv *env, jclass clz, jint base) {
    glListBase(base);
}

void JNICALL Java_jopengl_GL_glBegin
  (JNIEnv *env, jclass clz, jint mode) {
    glBegin(mode);
}

void JNICALL Java_jopengl_GL_glEnd
  (JNIEnv *env, jclass clz) {
    glEnd();
}

void JNICALL Java_jopengl_GL_glVertex__DD
  (JNIEnv *env, jclass clz, jdouble x, jdouble y) {
    glVertex2d(x, y);
}

void JNICALL Java_jopengl_GL_glVertex__FF
  (JNIEnv *env, jclass clz, jfloat x, jfloat y) {
    glVertex2f(x, y);
}

void JNICALL Java_jopengl_GL_glVertex__II
  (JNIEnv *env, jclass clz, jint x, jint y) {
    glVertex2i(x, y);
}

void JNICALL Java_jopengl_GL_glVertex__SS
  (JNIEnv *env, jclass clz, jshort x, jshort y) {
    glVertex2s(x, y);
}

void JNICALL Java_jopengl_GL_glVertex__DDD
  (JNIEnv *env, jclass clz, jdouble x, jdouble y, jdouble z) {
    glVertex3d(x, y, z);
}

void JNICALL Java_jopengl_GL_glVertex__FFF
  (JNIEnv *env, jclass clz, jfloat x, jfloat y, jfloat z) {
    glVertex3f(x, y, z);
}

void JNICALL Java_jopengl_GL_glVertex__III
  (JNIEnv *env, jclass clz, jint x, jint y, jint z) {
    glVertex3i(x, y, z);
}

void JNICALL Java_jopengl_GL_glVertex__SSS
  (JNIEnv *env, jclass clz, jshort x, jshort y, jshort z) {
    glVertex3s(x, y, z);
}

void JNICALL Java_jopengl_GL_glVertex__DDDD
  (JNIEnv *env, jclass clz, jdouble x, jdouble y, jdouble z, jdouble w) {
    glVertex4d(x, y, z, w);
}

void JNICALL Java_jopengl_GL_glVertex__FFFF
  (JNIEnv *env, jclass clz, jfloat x, jfloat y, jfloat z, jfloat w) {
    glVertex4f(x, y, z, w);
}

void JNICALL Java_jopengl_GL_glVertex__IIII
  (JNIEnv *env, jclass clz, jint x, jint y, jint z, jint w) {
    glVertex4i(x, y, z, w);
}

void JNICALL Java_jopengl_GL_glVertex__SSSS
  (JNIEnv *env, jclass clz, jshort x, jshort y, jshort z, jshort w) {
    glVertex4s(x, y, z, w);
}

void JNICALL Java_jopengl_GL_glVertex2___3D
  (JNIEnv *env, jclass clz, jdoubleArray v) {
    gdv(v, dv);
    glVertex2dv(dv);
    rdv(v, dv);
}

void JNICALL Java_jopengl_GL_glVertex2___3F
  (JNIEnv *env, jclass clz, jfloatArray v) {
    gfv(v, fv);
    glVertex2fv(fv);
    rfv(v, fv);
}

void JNICALL Java_jopengl_GL_glVertex2___3I
  (JNIEnv *env, jclass clz, jintArray v) {
    giv(v, iv);
    glVertex2iv(iv);
    riv(v, iv);
}

void JNICALL Java_jopengl_GL_glVertex2___3S
  (JNIEnv *env, jclass clz, jshortArray v) {
    gsv(v, sv);
    glVertex2sv(sv);
    rsv(v, sv);
}

void JNICALL Java_jopengl_GL_glVertex3___3D
  (JNIEnv *env, jclass clz, jdoubleArray v) {
    gdv(v, dv);
    glVertex3dv(dv);
    rdv(v, dv);
}

void JNICALL Java_jopengl_GL_glVertex3___3F
  (JNIEnv *env, jclass clz, jfloatArray v) {
    gfv(v, fv);
    glVertex3fv(fv);
    rfv(v, fv);
}

void JNICALL Java_jopengl_GL_glVertex3___3I
  (JNIEnv *env, jclass clz, jintArray v) {
    giv(v, iv);
    glVertex3iv(iv);
    riv(v, iv);
}

void JNICALL Java_jopengl_GL_glVertex3___3S
  (JNIEnv *env, jclass clz, jshortArray v) {
    gsv(v, sv);
    glVertex3sv(sv);
    rsv(v, sv);
}

void JNICALL Java_jopengl_GL_glVertex4___3D
  (JNIEnv *env, jclass clz, jdoubleArray v) {
    gdv(v, dv);
    glVertex4dv(dv);
    rdv(v, dv);
}

void JNICALL Java_jopengl_GL_glVertex4___3F
  (JNIEnv *env, jclass clz, jfloatArray v) {
    gfv(v, fv);
    glVertex4fv(fv);
    rfv(v, fv);
}

void JNICALL Java_jopengl_GL_glVertex4___3I
  (JNIEnv *env, jclass clz, jintArray v) {
    giv(v, iv);
    glVertex4iv(iv);
    riv(v, iv);
}

void JNICALL Java_jopengl_GL_glVertex4___3S
  (JNIEnv *env, jclass clz, jshortArray v) {
    gsv(v, sv);
    glVertex4sv(sv);
    rsv(v, sv);
}

void JNICALL Java_jopengl_GL_glNormal__BBB
  (JNIEnv *env, jclass clz, jbyte nx, jbyte ny, jbyte nz) {
    glNormal3b(nx, ny, nz);
}

void JNICALL Java_jopengl_GL_glNormal__DDD
  (JNIEnv *env, jclass clz, jdouble nx, jdouble ny, jdouble nz) {
    glNormal3d(nx, ny, nz);
}

void JNICALL Java_jopengl_GL_glNormal__FFF
  (JNIEnv *env, jclass clz, jfloat nx, jfloat ny, jfloat nz) {
    glNormal3f(nx, ny, nz);
}

void JNICALL Java_jopengl_GL_glNormal__III
  (JNIEnv *env, jclass clz, jint nx, jint ny, jint nz) {
    glNormal3i(nx, ny, nz);
}

void JNICALL Java_jopengl_GL_glNormal__SSS
  (JNIEnv *env, jclass clz, jshort nx, jshort ny, jshort nz) {
    glNormal3s(nx, ny, nz);
}

void JNICALL Java_jopengl_GL_glNormal3___3B
  (JNIEnv *env, jclass clz, jbyteArray v) {
    gbv(v, bv);
    glNormal3bv(bv);
    rbv(v, bv);
}

void JNICALL Java_jopengl_GL_glNormal3___3D
  (JNIEnv *env, jclass clz, jdoubleArray v) {
    gdv(v, dv);
    glNormal3dv(dv);
    rdv(v, dv);
}

void JNICALL Java_jopengl_GL_glNormal3___3F
  (JNIEnv *env, jclass clz, jfloatArray v) {
    gfv(v, fv);
    glNormal3fv(fv);
    rfv(v, fv);
}

void JNICALL Java_jopengl_GL_glNormal3___3I
  (JNIEnv *env, jclass clz, jintArray v) {
    giv(v, iv);
    glNormal3iv(iv);
    riv(v, iv);
}

void JNICALL Java_jopengl_GL_glNormal3___3S
  (JNIEnv *env, jclass clz, jshortArray v) {
    gsv(v, sv);
    glNormal3sv(sv);
    rsv(v, sv);
}

void JNICALL Java_jopengl_GL_glIndex__D
  (JNIEnv *env, jclass clz, jdouble c) {
    glIndexd(c);
}

void JNICALL Java_jopengl_GL_glIndex__F
  (JNIEnv *env, jclass clz, jfloat c) {
    glIndexf(c);
}

void JNICALL Java_jopengl_GL_glIndex__I
  (JNIEnv *env, jclass clz, jint c) {
    glIndexi(c);
}

void JNICALL Java_jopengl_GL_glIndex__S
  (JNIEnv *env, jclass clz, jshort c) {
    glIndexs(c);
}

void JNICALL Java_jopengl_GL_glIndex__B
  (JNIEnv *env, jclass clz, jbyte c) {
    glIndexub(c);
}

void JNICALL Java_jopengl_GL_glIndex___3D
  (JNIEnv *env, jclass clz, jdoubleArray c) {
    gdv(c, dv);
    glIndexdv(dv);
    rdv(c, dv);
}

void JNICALL Java_jopengl_GL_glIndex___3F
  (JNIEnv *env, jclass clz, jfloatArray c) {
    gfv(c, fv);
    glIndexfv(fv);
    rfv(c, fv);
}

void JNICALL Java_jopengl_GL_glIndex___3I
  (JNIEnv *env, jclass clz, jintArray c) {
    giv(c, iv);
    glIndexiv(iv);
    riv(c, iv);
}

void JNICALL Java_jopengl_GL_glIndex___3S
  (JNIEnv *env, jclass clz, jshortArray c) {
    gsv(c, sv);
    glIndexsv(sv);
    rsv(c, sv);
}

void JNICALL Java_jopengl_GL_glIndex___3B
  (JNIEnv *env, jclass clz, jbyteArray c) {
    gubv(c, bv);
    glIndexubv(bv);
    rbv(c, bv);
}

void JNICALL Java_jopengl_GL_glColor__BBB
  (JNIEnv *env, jclass clz, jbyte red, jbyte green, jbyte blue) {
    glColor3b(red, green, blue);
}

void JNICALL Java_jopengl_GL_glColor__DDD
  (JNIEnv *env, jclass clz, jdouble red, jdouble green, jdouble blue) {
    glColor3d(red, green, blue);
}

void JNICALL Java_jopengl_GL_glColor__FFF
  (JNIEnv *env, jclass clz, jfloat red, jfloat green, jfloat blue) {
    glColor3f(red, green, blue);
}

void JNICALL Java_jopengl_GL_glColor__III
  (JNIEnv *env, jclass clz, jint red, jint green, jint blue) {
    glColor3i(red, green, blue);
}

void JNICALL Java_jopengl_GL_glColor__SSS
  (JNIEnv *env, jclass clz, jshort red, jshort green, jshort blue) {
    glColor3s(red, green, blue);
}

void JNICALL Java_jopengl_GL_glColor__BBBB
  (JNIEnv *env, jclass clz, jbyte red, jbyte green, jbyte blue, jbyte alpha) {
    glColor4b(red, green, blue, alpha);
}

void JNICALL Java_jopengl_GL_glColor__DDDD
  (JNIEnv *env, jclass clz, jdouble red, jdouble green, jdouble blue, jdouble alpha) {
    glColor4d(red, green, blue, alpha);
}

void JNICALL Java_jopengl_GL_glColor__FFFF
  (JNIEnv *env, jclass clz, jfloat red, jfloat green, jfloat blue, jfloat alpha) {
    glColor4f(red, green, blue, alpha);
}

void JNICALL Java_jopengl_GL_glColor__IIII
  (JNIEnv *env, jclass clz, jint red, jint green, jint blue, jint alpha) {
    glColor4i(red, green, blue, alpha);
}

void JNICALL Java_jopengl_GL_glColor__SSSS
  (JNIEnv *env, jclass clz, jshort red, jshort green, jshort blue, jshort alpha) {
    glColor4s(red, green, blue, alpha);
}

void JNICALL Java_jopengl_GL_glColor3___3B
  (JNIEnv *env, jclass clz, jbyteArray v) {
    gbv(v, bv);
    glColor3bv(bv);
    rbv(v, bv);
}

void JNICALL Java_jopengl_GL_glColor3___3D
  (JNIEnv *env, jclass clz, jdoubleArray v) {
    gdv(v, dv);
    glColor3dv(dv);
    rdv(v, dv);
}

void JNICALL Java_jopengl_GL_glColor3___3F
  (JNIEnv *env, jclass clz, jfloatArray v) {
    gfv(v, fv);
    glColor3fv(fv);
    rfv(v, fv);
}

void JNICALL Java_jopengl_GL_glColor3___3I
  (JNIEnv *env, jclass clz, jintArray v) {
    giv(v, iv);
    glColor3iv(iv);
    riv(v, iv);
}

void JNICALL Java_jopengl_GL_glColor3___3S
  (JNIEnv *env, jclass clz, jshortArray v) {
    gsv(v, sv);
    glColor3sv(sv);
    rsv(v, sv);
}

void JNICALL Java_jopengl_GL_glColor4___3B
  (JNIEnv *env, jclass clz, jbyteArray v) {
    gbv(v, bv);
    glColor4bv(bv);
    rbv(v, bv);
}

void JNICALL Java_jopengl_GL_glColor4___3D
  (JNIEnv *env, jclass clz, jdoubleArray v) {
    gdv(v, dv);
    glColor4dv(dv);
    rdv(v, dv);
}

void JNICALL Java_jopengl_GL_glColor4___3F
  (JNIEnv *env, jclass clz, jfloatArray v) {
    gfv(v, fv);
    glColor4fv(fv);
    rfv(v, fv);
}

void JNICALL Java_jopengl_GL_glColor4___3I
  (JNIEnv *env, jclass clz, jintArray v) {
    giv(v, iv);
    glColor4iv(iv);
    riv(v, iv);
}

void JNICALL Java_jopengl_GL_glColor4___3S
  (JNIEnv *env, jclass clz, jshortArray v) {
    gsv(v, sv);
    glColor4sv(sv);
    rsv(v, sv);
}

void JNICALL Java_jopengl_GL_glTexCoord__D
  (JNIEnv *env, jclass clz, jdouble s) {
    glTexCoord1d(s);
}

void JNICALL Java_jopengl_GL_glTexCoord__F
  (JNIEnv *env, jclass clz, jfloat s) {
    glTexCoord1f(s);
}

void JNICALL Java_jopengl_GL_glTexCoord__I
  (JNIEnv *env, jclass clz, jint s) {
    glTexCoord1i(s);
}

void JNICALL Java_jopengl_GL_glTexCoord__S
  (JNIEnv *env, jclass clz, jshort s) {
    glTexCoord1s(s);
}

void JNICALL Java_jopengl_GL_glTexCoord__DD
  (JNIEnv *env, jclass clz, jdouble s, jdouble t) {
    glTexCoord2d(s, t);
}

void JNICALL Java_jopengl_GL_glTexCoord__FF
  (JNIEnv *env, jclass clz, jfloat s, jfloat t) {
    glTexCoord2f(s, t);
}

void JNICALL Java_jopengl_GL_glTexCoord__II
  (JNIEnv *env, jclass clz, jint s, jint t) {
    glTexCoord2i(s, t);
}

void JNICALL Java_jopengl_GL_glTexCoord__SS
  (JNIEnv *env, jclass clz, jshort s, jshort t) {
    glTexCoord2s(s, t);
}

void JNICALL Java_jopengl_GL_glTexCoord__DDD
  (JNIEnv *env, jclass clz, jdouble s, jdouble t, jdouble r) {
    glTexCoord3d(s, t, r);
}

void JNICALL Java_jopengl_GL_glTexCoord__FFF
  (JNIEnv *env, jclass clz, jfloat s, jfloat t, jfloat r) {
    glTexCoord3f(s, t, r);
}

void JNICALL Java_jopengl_GL_glTexCoord__III
  (JNIEnv *env, jclass clz, jint s, jint t, jint r) {
    glTexCoord3i(s, t, r);
}

void JNICALL Java_jopengl_GL_glTexCoord__SSS
  (JNIEnv *env, jclass clz, jshort s, jshort t, jshort r) {
    glTexCoord3s(s, t, r);
}

void JNICALL Java_jopengl_GL_glTexCoord__DDDD
  (JNIEnv *env, jclass clz, jdouble s, jdouble t, jdouble r, jdouble q) {
    glTexCoord4d(s, t, r, q);
}

void JNICALL Java_jopengl_GL_glTexCoord__FFFF
  (JNIEnv *env, jclass clz, jfloat s, jfloat t, jfloat r, jfloat q) {
    glTexCoord4f(s, t, r, q);
}

void JNICALL Java_jopengl_GL_glTexCoord__IIII
  (JNIEnv *env, jclass clz, jint s, jint t, jint r, jint q) {
    glTexCoord4i(s, t, r, q);
}

void JNICALL Java_jopengl_GL_glTexCoord__SSSS
  (JNIEnv *env, jclass clz, jshort s, jshort t, jshort r, jshort q) {
    glTexCoord4s(s, t, r, q);
}

void JNICALL Java_jopengl_GL_glTexCoord1___3D
  (JNIEnv *env, jclass clz, jdoubleArray v) {
    gdv(v, dv);
    glTexCoord1dv(dv);
    rdv(v, dv);
}

void JNICALL Java_jopengl_GL_glTexCoord1___3F
  (JNIEnv *env, jclass clz, jfloatArray v) {
    gfv(v, fv);
    glTexCoord1fv(fv);
    rfv(v, fv);
}

void JNICALL Java_jopengl_GL_glTexCoord1___3I
  (JNIEnv *env, jclass clz, jintArray v) {
    giv(v, iv);
    glTexCoord1iv(iv);
    riv(v, iv);
}

void JNICALL Java_jopengl_GL_glTexCoord1___3S
  (JNIEnv *env, jclass clz, jshortArray v) {
    gsv(v, sv);
    glTexCoord1sv(sv);
    rsv(v, sv);
}

void JNICALL Java_jopengl_GL_glTexCoord2___3D
  (JNIEnv *env, jclass clz, jdoubleArray v) {
    gdv(v, dv);
    glTexCoord2dv(dv);
    rdv(v, dv);
}

void JNICALL Java_jopengl_GL_glTexCoord2___3F
  (JNIEnv *env, jclass clz, jfloatArray v) {
    gfv(v, fv);
    glTexCoord2fv(fv);
    rfv(v, fv);
}

void JNICALL Java_jopengl_GL_glTexCoord2___3I
  (JNIEnv *env, jclass clz, jintArray v) {
    giv(v, iv);
    glTexCoord2iv(iv);
    riv(v, iv);
}

void JNICALL Java_jopengl_GL_glTexCoord2___3S
  (JNIEnv *env, jclass clz, jshortArray v) {
    gsv(v, sv);
    glTexCoord2sv(sv);
    rsv(v, sv);
}

void JNICALL Java_jopengl_GL_glTexCoord3___3D
  (JNIEnv *env, jclass clz, jdoubleArray v) {
    gdv(v, dv);
    glTexCoord3dv(dv);
    rdv(v, dv);
}

void JNICALL Java_jopengl_GL_glTexCoord3___3F
  (JNIEnv *env, jclass clz, jfloatArray v) {
    gfv(v, fv);
    glTexCoord3fv(fv);
    rfv(v, fv);
}

void JNICALL Java_jopengl_GL_glTexCoord3___3I
  (JNIEnv *env, jclass clz, jintArray v) {
    giv(v, iv);
    glTexCoord3iv(iv);
    riv(v, iv);
}

void JNICALL Java_jopengl_GL_glTexCoord3___3S
  (JNIEnv *env, jclass clz, jshortArray v) {
    gsv(v, sv);
    glTexCoord3sv(sv);
    rsv(v, sv);
}

void JNICALL Java_jopengl_GL_glTexCoord4___3D
  (JNIEnv *env, jclass clz, jdoubleArray v) {
    gdv(v, dv);
    glTexCoord4dv(dv);
    rdv(v, dv);
}

void JNICALL Java_jopengl_GL_glTexCoord4___3F
  (JNIEnv *env, jclass clz, jfloatArray v) {
    gfv(v, fv);
    glTexCoord4fv(fv);
    rfv(v, fv);
}

void JNICALL Java_jopengl_GL_glTexCoord4___3I
  (JNIEnv *env, jclass clz, jintArray v) {
    giv(v, iv);
    glTexCoord4iv(iv);
    riv(v, iv);
}

void JNICALL Java_jopengl_GL_glTexCoord4___3S
  (JNIEnv *env, jclass clz, jshortArray v) {
    gsv(v, sv);
    glTexCoord4sv(sv);
    rsv(v, sv);
}

void JNICALL Java_jopengl_GL_glRasterPos__DD
  (JNIEnv *env, jclass clz, jdouble x, jdouble y) {
    glRasterPos2d(x, y);
}

void JNICALL Java_jopengl_GL_glRasterPos__FF
  (JNIEnv *env, jclass clz, jfloat x, jfloat y) {
    glRasterPos2f(x, y);
}

void JNICALL Java_jopengl_GL_glRasterPos__II
  (JNIEnv *env, jclass clz, jint x, jint y) {
    glRasterPos2i(x, y);
}

void JNICALL Java_jopengl_GL_glRasterPos__SS
  (JNIEnv *env, jclass clz, jshort x, jshort y) {
    glRasterPos2s(x, y);
}

void JNICALL Java_jopengl_GL_glRasterPos__DDD
  (JNIEnv *env, jclass clz, jdouble x, jdouble y, jdouble z) {
    glRasterPos3d(x, y, z);
}

void JNICALL Java_jopengl_GL_glRasterPos__FFF
  (JNIEnv *env, jclass clz, jfloat x, jfloat y, jfloat z) {
    glRasterPos3f(x, y, z);
}

void JNICALL Java_jopengl_GL_glRasterPos__III
  (JNIEnv *env, jclass clz, jint x, jint y, jint z) {
    glRasterPos3i(x, y, z);
}

void JNICALL Java_jopengl_GL_glRasterPos__SSS
  (JNIEnv *env, jclass clz, jshort x, jshort y, jshort z) {
    glRasterPos3s(x, y, z);
}

void JNICALL Java_jopengl_GL_glRasterPos__DDDD
  (JNIEnv *env, jclass clz, jdouble x, jdouble y, jdouble z, jdouble w) {
    glRasterPos4d(x, y, z, w);
}

void JNICALL Java_jopengl_GL_glRasterPos__FFFF
  (JNIEnv *env, jclass clz, jfloat x, jfloat y, jfloat z, jfloat w) {
    glRasterPos4f(x, y, z, w);
}

void JNICALL Java_jopengl_GL_glRasterPos__IIII
  (JNIEnv *env, jclass clz, jint x, jint y, jint z, jint w) {
    glRasterPos4i(x, y, z, w);
}

void JNICALL Java_jopengl_GL_glRasterPos__SSSS
  (JNIEnv *env, jclass clz, jshort x, jshort y, jshort z, jshort w) {
    glRasterPos4s(x, y, z, w);
}

void JNICALL Java_jopengl_GL_glRasterPos2___3D
  (JNIEnv *env, jclass clz, jdoubleArray v) {
    gdv(v, dv);
    glRasterPos2dv(dv);
    rdv(v, dv);
}

void JNICALL Java_jopengl_GL_glRasterPos2___3F
  (JNIEnv *env, jclass clz, jfloatArray v) {
    gfv(v, fv);
    glRasterPos2fv(fv);
    rfv(v, fv);
}

void JNICALL Java_jopengl_GL_glRasterPos2___3I
  (JNIEnv *env, jclass clz, jintArray v) {
    giv(v, iv);
    glRasterPos2iv(iv);
    riv(v, iv);
}

void JNICALL Java_jopengl_GL_glRasterPos2___3S
  (JNIEnv *env, jclass clz, jshortArray v) {
    gsv(v, sv);
    glRasterPos2sv(sv);
    rsv(v, sv);
}

void JNICALL Java_jopengl_GL_glRasterPos3___3D
  (JNIEnv *env, jclass clz, jdoubleArray v) {
    gdv(v, dv);
    glRasterPos3dv(dv);
    rdv(v, dv);
}

void JNICALL Java_jopengl_GL_glRasterPos3___3F
  (JNIEnv *env, jclass clz, jfloatArray v) {
    gfv(v, fv);
    glRasterPos3fv(fv);
    rfv(v, fv);
}

void JNICALL Java_jopengl_GL_glRasterPos3___3I
  (JNIEnv *env, jclass clz, jintArray v) {
    giv(v, iv);
    glRasterPos3iv(iv);
    riv(v, iv);
}

void JNICALL Java_jopengl_GL_glRasterPos3___3S
  (JNIEnv *env, jclass clz, jshortArray v) {
    gsv(v, sv);
    glRasterPos3sv(sv);
    rsv(v, sv);
}

void JNICALL Java_jopengl_GL_glRasterPos4___3D
  (JNIEnv *env, jclass clz, jdoubleArray v) {
    gdv(v, dv);
    glRasterPos4dv(dv);
    rdv(v, dv);
}

void JNICALL Java_jopengl_GL_glRasterPos4___3F
  (JNIEnv *env, jclass clz, jfloatArray v) {
    gfv(v, fv);
    glRasterPos4fv(fv);
    rfv(v, fv);
}

void JNICALL Java_jopengl_GL_glRasterPos4___3I
  (JNIEnv *env, jclass clz, jintArray v) {
    giv(v, iv);
    glRasterPos4iv(iv);
    riv(v, iv);
}

void JNICALL Java_jopengl_GL_glRasterPos4___3S
  (JNIEnv *env, jclass clz, jshortArray v) {
    gsv(v, sv);
    glRasterPos4sv(sv);
    rsv(v, sv);
}

void JNICALL Java_jopengl_GL_glRect__DDDD
  (JNIEnv *env, jclass clz, jdouble x1, jdouble y1, jdouble x2, jdouble y2) {
    glRectd(x1, y1, x2, y2);
}

void JNICALL Java_jopengl_GL_glRect__FFFF
  (JNIEnv *env, jclass clz, jfloat x1, jfloat y1, jfloat x2, jfloat y2) {
    glRectf(x1, y1, x2, y2);
}

void JNICALL Java_jopengl_GL_glRect__IIII
  (JNIEnv *env, jclass clz, jint x1, jint y1, jint x2, jint y2) {
    glRecti(x1, y1, x2, y2);
}

void JNICALL Java_jopengl_GL_glRect__SSSS
  (JNIEnv *env, jclass clz, jshort x1, jshort y1, jshort x2, jshort y2) {
    glRects(x1, y1, x2, y2);
}

void JNICALL Java_jopengl_GL_glRect___3D_3D
  (JNIEnv *env, jclass clz, jdoubleArray v1, jdoubleArray v2) {
    gdv(v1, dv1);
    gdv(v2, dv2);
    glRectdv(dv1, dv2);
    rdv(v1, dv1);
    rdv(v2, dv2);
}

void JNICALL Java_jopengl_GL_glRect___3F_3F
  (JNIEnv *env, jclass clz, jfloatArray v1, jfloatArray v2) {
    gfv(v1, fv1);
    gfv(v2, fv2);
    glRectfv(fv1, fv2);
    rfv(v1, fv1);
    rfv(v2, fv2);
}

void JNICALL Java_jopengl_GL_glRect___3I_3I
  (JNIEnv *env, jclass clz, jintArray v1, jintArray v2) {
    giv(v1, iv1);
    giv(v2, iv2);
    glRectiv(iv1, iv2);
    riv(v1, iv1);
    riv(v2, iv2);
}

void JNICALL Java_jopengl_GL_glRect___3S_3S
  (JNIEnv *env, jclass clz, jshortArray v1, jshortArray v2) {
    gsv(v1, sv1);
    gsv(v2, sv2);
    glRectsv(sv1, sv2);
    rsv(v1, sv1);
    rsv(v2, sv2);
}

void JNICALL Java_jopengl_GL_glShadeModel
  (JNIEnv *env, jclass clz, jint mode) {
    glShadeModel(mode);
}

void JNICALL Java_jopengl_GL_glLight__IIF
  (JNIEnv *env, jclass clz, jint light, jint pname, jfloat param) {
    glLightf(light, pname, param);
}

void JNICALL Java_jopengl_GL_glLight__III
  (JNIEnv *env, jclass clz, jint light, jint pname, jint param) {
    glLighti(light, pname, param);
}

void JNICALL Java_jopengl_GL_glLight__II_3F
  (JNIEnv *env, jclass clz, jint light, jint pname, jfloatArray param) {
    gfv(param, fv);
    glLightfv(light, pname, fv);
    rfv(param, fv);
}

void JNICALL Java_jopengl_GL_glLight__II_3I
  (JNIEnv *env, jclass clz, jint light, jint pname, jintArray param) {
    giv(param, iv);
    glLightiv(light, pname, iv);
    riv(param, iv);
}

void JNICALL Java_jopengl_GL_glGetLight__II_3F
  (JNIEnv *env, jclass clz, jint light, jint pname, jfloatArray param) {
    gfv(param, fv);
    glGetLightfv(light, pname, fv);
    rfv(param, fv);
}

void JNICALL Java_jopengl_GL_glGetLight__II_3I
  (JNIEnv *env, jclass clz, jint light, jint pname, jintArray param) {
    giv(param, iv);
    glGetLightiv(light, pname, iv);
    riv(param, iv);
}

void JNICALL Java_jopengl_GL_glLightModel__IF
  (JNIEnv *env, jclass clz, jint pname, jfloat param) {
    glLightModelf(pname, param);
}

void JNICALL Java_jopengl_GL_glLightModel__II
  (JNIEnv *env, jclass clz, jint pname, jint param) {
    glLightModeli(pname, param);
}

void JNICALL Java_jopengl_GL_glLightModel__I_3F
  (JNIEnv *env, jclass clz, jint pname, jfloatArray param) {
    gfv(param, fv);
    glLightModelfv(pname, fv);
    rfv(param, fv);
}

void JNICALL Java_jopengl_GL_glLightModel__I_3I
  (JNIEnv *env, jclass clz, jint pname, jintArray param) {
    giv(param, iv);
    glLightModeliv(pname, iv);
    riv(param, iv);
}

void JNICALL Java_jopengl_GL_glMaterial__IIF
  (JNIEnv *env, jclass clz, jint face, jint pname, jfloat param) {
    glMaterialf(face, pname, param);
}

void JNICALL Java_jopengl_GL_glMaterial__III
  (JNIEnv *env, jclass clz, jint face, jint pname, jint param) {
    glMateriali(face, pname, param);
}

void JNICALL Java_jopengl_GL_glMaterial__II_3F
  (JNIEnv *env, jclass clz, jint face, jint pname, jfloatArray param) {
    gfv(param, fv);
    glMaterialfv(face, pname, fv);
    rfv(param, fv);
}

void JNICALL Java_jopengl_GL_glMaterial__II_3I
  (JNIEnv *env, jclass clz, jint face, jint pname, jintArray param) {
    giv(param, iv);
    glMaterialiv(face, pname, iv);
    riv(param, iv);
}

void JNICALL Java_jopengl_GL_glGetMaterial__II_3F
  (JNIEnv *env, jclass clz, jint face, jint pname, jfloatArray param) {
    gfv(param, fv);
    glGetMaterialfv(face, pname, fv);
    rfv(param, fv);
}

void JNICALL Java_jopengl_GL_glGetMaterial__II_3I
  (JNIEnv *env, jclass clz, jint face, jint pname, jintArray param) {
    giv(param, iv);
    glGetMaterialiv(face, pname, iv);
    riv(param, iv);
}

void JNICALL Java_jopengl_GL_glColorMaterial
  (JNIEnv *env, jclass clz, jint face, jint mode) {
    glColorMaterial(face, mode);
}

void JNICALL Java_jopengl_GL_glPixelZoom
  (JNIEnv *env, jclass clz, jfloat xfactor, jfloat yfactor) {
    glPixelZoom(xfactor, yfactor);
}

void JNICALL Java_jopengl_GL_glPixelStore__IF
  (JNIEnv *env, jclass clz, jint pname, jfloat param) {
    glPixelStoref(pname, param);
}

void JNICALL Java_jopengl_GL_glPixelStore__II
  (JNIEnv *env, jclass clz, jint pname, jint param) {
    glPixelStorei(pname, param);
}

void JNICALL Java_jopengl_GL_glPixelTransfer__IF
  (JNIEnv *env, jclass clz, jint pname, jfloat param) {
    glPixelTransferf(pname, param);
}

void JNICALL Java_jopengl_GL_glPixelTransfer__II
  (JNIEnv *env, jclass clz, jint pname, jint param) {
    glPixelTransferi(pname, param);
}

void JNICALL Java_jopengl_GL_glPixelMap__II_3F
  (JNIEnv *env, jclass clz, jint map, jint mapsize, jfloatArray values) {
    gfv(values, fv);
    glPixelMapfv(map, mapsize, fv);
    rfv(values, fv);
}

void JNICALL Java_jopengl_GL_glPixelMap__II_3I
  (JNIEnv *env, jclass clz, jint map, jint mapsize, jintArray values) {
    guiv(values, iv);
    glPixelMapuiv(map, mapsize, iv);
    riv(values, iv);
}

void JNICALL Java_jopengl_GL_glPixelMap__II_3S
  (JNIEnv *env, jclass clz, jint map, jint mapsize, jshortArray values) {
    gusv(values, sv);
    glPixelMapusv(map, mapsize, sv);
    rsv(values, sv);
}

void JNICALL Java_jopengl_GL_glGetPixelMap__I_3F
  (JNIEnv *env, jclass clz, jint map, jfloatArray values) {
    gfv(values, fv);
    glGetPixelMapfv(map, fv);
    rfv(values, fv);
}

void JNICALL Java_jopengl_GL_glGetPixelMap__I_3I
  (JNIEnv *env, jclass clz, jint map, jintArray values) {
    guiv(values, iv);
    glGetPixelMapuiv(map, iv);
    riv(values, iv);
}

void JNICALL Java_jopengl_GL_glGetPixelMap__I_3S
  (JNIEnv *env, jclass clz, jint map, jshortArray values) {
    gusv(values, sv);
    glGetPixelMapusv(map, sv);
    rsv(values, sv);
}

void JNICALL Java_jopengl_GL_glBitmap
  (JNIEnv *env, jclass clz, jint width, jint height, jfloat xorig, jfloat yorig, jfloat xmove, jfloat ymove, jbyteArray bitmap) {
    gubv(bitmap, bv);
    glBitmap(width, height, xorig, yorig, xmove, ymove, bv);
    rbv(bitmap, bv);
}

jbyteArray JNICALL Java_jopengl_GL_glReadPixels__IIIII_3B
  (JNIEnv *env, jclass clz, jint x, jint y, jint width, jint height, jint format, jbyteArray pixels) {
    gubv(pixels, bv);
    glReadPixels(x, y, width, height, format, GL_UNSIGNED_BYTE, bv);
    rbv(pixels, bv);
    return pixels;
}

jfloatArray JNICALL Java_jopengl_GL_glReadPixels__IIIII_3F
  (JNIEnv *env, jclass clz, jint x, jint y, jint width, jint height, jint format, jfloatArray pixels) {
    gfv(pixels, fv);
    glReadPixels(x, y, width, height, format, GL_FLOAT, fv);
    rfv(pixels, fv);
    return pixels;
}

jdoubleArray JNICALL Java_jopengl_GL_glReadPixels__IIIII_3D
  (JNIEnv *env, jclass clz, jint x, jint y, jint width, jint height, jint format, jdoubleArray pixels) {
    gdv(pixels, dv);
    glReadPixels(x, y, width, height, format, GL_DOUBLE, dv);
    rdv(pixels, dv);
    return pixels;
}

void JNICALL Java_jopengl_GL_glReadPixels__IIIIIIJ
  (JNIEnv *env, jclass clz, jint x, jint y, jint width, jint height, jint format, jint type, jlong pixelsAddr) {
    glReadPixels(x, y, width, height, format, type, (GLvoid*)pixelsAddr);
}

void JNICALL Java_jopengl_GL_glDrawPixels__III_3B
  (JNIEnv *env, jclass clz, jint width, jint height, jint format, jbyteArray pixels) {
    gubv(pixels, bv);
    glDrawPixels(width, height, format, GL_UNSIGNED_BYTE, bv);
    rbv(pixels, bv);
}

void JNICALL Java_jopengl_GL_glDrawPixels__IIIIJ
  (JNIEnv *env, jclass clz, jint width, jint height, jint format, jint type, jlong pixelsAddr) {
    glDrawPixels(width, height, format, type, (GLvoid*)pixelsAddr);
}

void JNICALL Java_jopengl_GL_glCopyPixels
  (JNIEnv *env, jclass clz, jint x, jint y, jint width, jint height, jint type) {
    glCopyPixels(x, y, width, height, type);
}

void JNICALL Java_jopengl_GL_glStencilMask
  (JNIEnv *env, jclass clz, jint mask) {
    glStencilMask(mask);
}

void JNICALL Java_jopengl_GL_glStencilOp
  (JNIEnv *env, jclass clz, jint fail, jint zfail, jint zpass) {
    glStencilOp(fail, zfail, zpass);
}

void JNICALL Java_jopengl_GL_glClearStencil
  (JNIEnv *env, jclass clz, jint s) {
    glClearStencil(s);
}

void JNICALL Java_jopengl_GL_glTexGen__IID
  (JNIEnv *env, jclass clz, jint coord, jint pname, jdouble param) {
    glTexGend(coord, pname, param);
}

void JNICALL Java_jopengl_GL_glTexGen__IIF
  (JNIEnv *env, jclass clz, jint coord, jint pname, jfloat param) {
    glTexGenf(coord, pname, param);
}

void JNICALL Java_jopengl_GL_glTexGen__III
  (JNIEnv *env, jclass clz, jint coord, jint pname, jint param) {
    glTexGeni(coord, pname, param);
}

void JNICALL Java_jopengl_GL_glTexGen__II_3D
  (JNIEnv *env, jclass clz, jint coord, jint pname, jdoubleArray param) {
    gdv(param, dv);
    glTexGendv(coord, pname, dv);
    rdv(param, dv);
}

void JNICALL Java_jopengl_GL_glTexGen__II_3F
  (JNIEnv *env, jclass clz, jint coord, jint pname, jfloatArray param) {
    gfv(param, fv);
    glTexGenfv(coord, pname, fv);
    rfv(param, fv);
}

void JNICALL Java_jopengl_GL_glTexGen__II_3I
  (JNIEnv *env, jclass clz, jint coord, jint pname, jintArray param) {
    giv(param, iv);
    glTexGeniv(coord, pname, iv);
    riv(param, iv);
}

void JNICALL Java_jopengl_GL_glGetTexGen__II_3D
  (JNIEnv *env, jclass clz, jint coord, jint pname, jdoubleArray param) {
    gdv(param, dv);
    glGetTexGendv(coord, pname, dv);
    rdv(param, dv);
}

void JNICALL Java_jopengl_GL_glGetTexGen__II_3F
  (JNIEnv *env, jclass clz, jint coord, jint pname, jfloatArray param) {
    gfv(param, fv);
    glGetTexGenfv(coord, pname, fv);
    rfv(param, fv);
}

void JNICALL Java_jopengl_GL_glGetTexGen__II_3I
  (JNIEnv *env, jclass clz, jint coord, jint pname, jintArray param) {
    giv(param, iv);
    glGetTexGeniv(coord, pname, iv);
    riv(param, iv);
}

void JNICALL Java_jopengl_GL_glTexEnv__IIF
  (JNIEnv *env, jclass clz, jint target, jint pname, jfloat param) {
    glTexEnvf(target, pname, param);
}

void JNICALL Java_jopengl_GL_glTexEnv__III
  (JNIEnv *env, jclass clz, jint target, jint pname, jint param) {
    glTexEnvi(target, pname, param);
}

void JNICALL Java_jopengl_GL_glTexEnv__II_3F
  (JNIEnv *env, jclass clz, jint target, jint pname, jfloatArray param) {
    gfv(param, fv);
    glTexEnvfv(target, pname, fv);
    rfv(param, fv);
}

void JNICALL Java_jopengl_GL_glTexEnv__II_3I
  (JNIEnv *env, jclass clz, jint target, jint pname, jintArray param) {
    giv(param, iv);
    glTexEnviv(target, pname, iv);
    riv(param, iv);
}

void JNICALL Java_jopengl_GL_glGetTexEnv__II_3F
  (JNIEnv *env, jclass clz, jint target, jint pname, jfloatArray params) {
    gfv(params, fv);
    glGetTexEnvfv(target, pname, fv);
    rfv(params, fv);
}

void JNICALL Java_jopengl_GL_glGetTexEnv__II_3I
  (JNIEnv *env, jclass clz, jint target, jint pname, jintArray params) {
    giv(params, iv);
    glGetTexEnviv(target, pname, iv);
    riv(params, iv);
}

void JNICALL Java_jopengl_GL_glTexParameter__IIF
  (JNIEnv *env, jclass clz, jint target, jint pname, jfloat param) {
    glTexParameterf(target, pname, param);
}

void JNICALL Java_jopengl_GL_glTexParameter__III
  (JNIEnv *env, jclass clz, jint target, jint pname, jint param) {
    glTexParameteri(target, pname, param);
}

void JNICALL Java_jopengl_GL_glTexParameter__II_3F
  (JNIEnv *env, jclass clz, jint target, jint pname, jfloatArray param) {
    gfv(param, fv);
    glTexParameterfv(target, pname, fv);
    rfv(param, fv);
}

void JNICALL Java_jopengl_GL_glTexParameter__II_3I
  (JNIEnv *env, jclass clz, jint target, jint pname, jintArray param) {
    giv(param, iv);
    glTexParameteriv(target, pname, iv);
    riv(param, iv);
}

void JNICALL Java_jopengl_GL_glGetTexParameter__II_3F
  (JNIEnv *env, jclass clz, jint target, jint pname, jfloatArray params) {
    gfv(params, fv);
    glGetTexParameterfv(target, pname, fv);
    rfv(params, fv);
}

void JNICALL Java_jopengl_GL_glGetTexParameter__II_3I
  (JNIEnv *env, jclass clz, jint target, jint pname, jintArray params) {
    giv(params, iv);
    glGetTexParameteriv(target, pname, iv);
    riv(params, iv);
}

void JNICALL Java_jopengl_GL_glGetTexLevelParameter__III_3F
  (JNIEnv *env, jclass clz, jint target, jint level, jint pname, jfloatArray params) {
    gfv(params, fv);
    glGetTexLevelParameterfv(target, level, pname, fv);
    rfv(params, fv);
}

void JNICALL Java_jopengl_GL_glGetTexLevelParameter__III_3I
  (JNIEnv *env, jclass clz, jint target, jint level, jint pname, jintArray params) {
    giv(params, iv);
    glGetTexLevelParameteriv(target, level, pname, iv);
    riv(params, iv);
}

void JNICALL Java_jopengl_GL_glTexImage1D__IIIIII_3B
  (JNIEnv *env, jclass clz, jint target, jint level, jint internalformat, jint width, jint border, jint format, jbyteArray pixels) {
    gubv(pixels, bv);
    glTexImage1D(target, level, internalformat, width, border, format, GL_UNSIGNED_BYTE, bv);
    rbv(pixels, bv);
}

void JNICALL Java_jopengl_GL_glTexImage1D__IIIIIIIJ
  (JNIEnv *env, jclass clz, jint target, jint level, jint internalformat, jint width, jint border, jint format, jint type, jlong pixelsAddr) {
    glTexImage1D(target, level, internalformat, width, border, format, type, (GLvoid*)pixelsAddr);
}

void JNICALL Java_jopengl_GL_glTexImage2D__IIIIIII_3B
  (JNIEnv *env, jclass clz, jint target, jint level, jint internalformat, jint width, jint height, jint border, jint format, jbyteArray pixels) {
    gubv(pixels, bv);
    glTexImage2D(target, level, internalformat, width, height, border, format, GL_UNSIGNED_BYTE, bv);
    rbv(pixels, bv);
}

void JNICALL Java_jopengl_GL_glTexImage2D__IIIIIIIIJ
  (JNIEnv *env, jclass clz, jint target, jint level, jint internalformat, jint width, jint height, jint border, jint format, jint type, jlong pixelsAddr) {
    glTexImage2D(target, level, internalformat, width, height, border, format, type, (GLvoid*)pixelsAddr);
}

void JNICALL Java_jopengl_GL_glGetTexImage__III_3B
  (JNIEnv *env, jclass clz, jint target, jint level, jint format, jbyteArray pixels) {
    gubv(pixels, bv);
    glGetTexImage(target, level, format, GL_UNSIGNED_BYTE, bv);
    rbv(pixels, bv);
}

void JNICALL Java_jopengl_GL_glGetTexImage__IIIIJ
  (JNIEnv *env, jclass clz, jint target, jint level, jint format, jint type, jlong pixelsAddr) {
    glGetTexImage(target, level, format, type, (GLvoid*)pixelsAddr);
}

void JNICALL Java_jopengl_GL_glMap__IDDII_3D
  (JNIEnv *env, jclass clz, jint target, jdouble u1, jdouble u2, jint stride, jint order, jdoubleArray points) {
    gdv(points, dv);
    glMap1d(target, u1, u2, stride, order, dv);
    rdv(points, dv);
}

void JNICALL Java_jopengl_GL_glMap__IFFII_3F
  (JNIEnv *env, jclass clz, jint target, jfloat u1, jfloat u2, jint stride, jint order, jfloatArray points) {
    gfv(points, fv);
    glMap1f(target, u1, u2, stride, order, fv);
    rfv(points, fv);
}

void JNICALL Java_jopengl_GL_glMap__IDDIIDDII_3D
  (JNIEnv *env, jclass clz, jint target, jdouble u1, jdouble u2, jint ustride, jint uorder, jdouble v1, jdouble v2, jint vstride, jint vorder, jdoubleArray points) {
    gdv(points, dv);
    glMap2d(target, u1, u2, ustride, uorder, v1, v2, vstride, vorder, dv);
    rdv(points, dv);
}

void JNICALL Java_jopengl_GL_glMap__IFFIIFFII_3F
  (JNIEnv *env, jclass clz, jint target, jfloat u1, jfloat u2, jint ustride, jint uorder, jfloat v1, jfloat v2, jint vstride, jint vorder, jfloatArray points) {
    gfv(points, fv);
    glMap2f(target, u1, u2, ustride, uorder, v1, v2, vstride, vorder, fv);
    rfv(points, fv);
}

void JNICALL Java_jopengl_GL_glGetMap__II_3D
  (JNIEnv *env, jclass clz, jint target, jint query, jdoubleArray v) {
    gdv(v, dv);
    glGetMapdv(target, query, dv);
    rdv(v, dv);
}

void JNICALL Java_jopengl_GL_glGetMap__II_3F
  (JNIEnv *env, jclass clz, jint target, jint query, jfloatArray v) {
    gfv(v, fv);
    glGetMapfv(target, query, fv);
    rfv(v, fv);
}

void JNICALL Java_jopengl_GL_glGetMap__II_3I
  (JNIEnv *env, jclass clz, jint target, jint query, jintArray v) {
    giv(v, iv);
    glGetMapiv(target, query, iv);
    riv(v, iv);
}

void JNICALL Java_jopengl_GL_glEvalCoord__D
  (JNIEnv *env, jclass clz, jdouble u) {
    glEvalCoord1d(u);
}

void JNICALL Java_jopengl_GL_glEvalCoord__F
  (JNIEnv *env, jclass clz, jfloat u) {
    glEvalCoord1f(u);
}

void JNICALL Java_jopengl_GL_glEvalCoord1___3D
  (JNIEnv *env, jclass clz, jdoubleArray u) {
    gdv(u, dv);
    glEvalCoord1dv(dv);
    rdv(u, dv);
}

void JNICALL Java_jopengl_GL_glEvalCoord1___3F
  (JNIEnv *env, jclass clz, jfloatArray u) {
    gfv(u, fv);
    glEvalCoord1fv(fv);
    rfv(u, fv);
}

void JNICALL Java_jopengl_GL_glEvalCoord__DD
  (JNIEnv *env, jclass clz, jdouble u, jdouble v) {
    glEvalCoord2d(u, v);
}

void JNICALL Java_jopengl_GL_glEvalCoord__FF
  (JNIEnv *env, jclass clz, jfloat u, jfloat v) {
    glEvalCoord2f(u, v);
}

void JNICALL Java_jopengl_GL_glEvalCoord2___3D
  (JNIEnv *env, jclass clz, jdoubleArray u) {
    gdv(u, dv);
    glEvalCoord2dv(dv);
    rdv(u, dv);
}

void JNICALL Java_jopengl_GL_glEvalCoord2___3F
  (JNIEnv *env, jclass clz, jfloatArray u) {
    gfv(u, fv);
    glEvalCoord2fv(fv);
    rfv(u, fv);
}

void JNICALL Java_jopengl_GL_glMapGrid__IDD
  (JNIEnv *env, jclass clz, jint un, jdouble u1, jdouble u2) {
    glMapGrid1d(un, u1, u2);
}

void JNICALL Java_jopengl_GL_glMapGrid__IFF
  (JNIEnv *env, jclass clz, jint un, jfloat u1, jfloat u2) {
    glMapGrid1f(un, u1, u2);
}

void JNICALL Java_jopengl_GL_glMapGrid__IDDIDD
  (JNIEnv *env, jclass clz, jint un, jdouble u1, jdouble u2, jint vn, jdouble v1, jdouble v2) {
    glMapGrid2d(un, u1, u2, vn, v1, v2);
}

void JNICALL Java_jopengl_GL_glMapGrid__IFFIFF
  (JNIEnv *env, jclass clz, jint un, jfloat u1, jfloat u2, jint vn, jfloat v1, jfloat v2) {
    glMapGrid2f(un, u1, u2, vn, v1, v2);
}

void JNICALL Java_jopengl_GL_glEvalPoint__I
  (JNIEnv *env, jclass clz, jint i) {
    glEvalPoint1(i);
}

void JNICALL Java_jopengl_GL_glEvalPoint__II
  (JNIEnv *env, jclass clz, jint i, jint j) {
    glEvalPoint2(i, j);
}

void JNICALL Java_jopengl_GL_glEvalMesh__III
  (JNIEnv *env, jclass clz, jint mode, jint i1, jint i2) {
    glEvalMesh1(mode, i1, i2);
}

void JNICALL Java_jopengl_GL_glEvalMesh__IIIII
  (JNIEnv *env, jclass clz, jint mode, jint i1, jint i2, jint j1, jint j2) {
    glEvalMesh2(mode, i1, i2, j1, j2);
}

void JNICALL Java_jopengl_GL_glFog__IF
  (JNIEnv *env, jclass clz, jint pname, jfloat param) {
    glFogf(pname, param);
}

void JNICALL Java_jopengl_GL_glFog__II
  (JNIEnv *env, jclass clz, jint pname, jint param) {
    glFogi(pname, param);
}

void JNICALL Java_jopengl_GL_glFog__I_3F
  (JNIEnv *env, jclass clz, jint pname, jfloatArray params) {
    gfv(params, fv);
    glFogfv(pname, fv);
    rfv(params, fv);
}

void JNICALL Java_jopengl_GL_glFog__I_3I
  (JNIEnv *env, jclass clz, jint pname, jintArray params) {
    giv(params, iv);
    glFogiv(pname, iv);
    riv(params, iv);
}

void JNICALL Java_jopengl_GL_glFeedbackBuffer
  (JNIEnv *env, jclass clz, jint size, jint type, jfloatArray buffer) {
    gfv(buffer, fv);
    glFeedbackBuffer(size, type, fv);
    rfv(buffer, fv);
}

void JNICALL Java_jopengl_GL_glPassThrough
  (JNIEnv *env, jclass clz, jfloat token) {
    glPassThrough(token);
}

void JNICALL Java_jopengl_GL_glSelectBuffer
  (JNIEnv *env, jclass clz, jint size, jintArray buffer) {
    guiv(buffer, iv);
    glSelectBuffer(size, iv);
    riv(buffer, iv);
}

void JNICALL Java_jopengl_GL_glInitNames
  (JNIEnv *env, jclass clz) {
    glInitNames();
}

void JNICALL Java_jopengl_GL_glLoadName
  (JNIEnv *env, jclass clz, jint name) {
    glLoadName(name);
}

void JNICALL Java_jopengl_GL_glPushName
  (JNIEnv *env, jclass clz, jint name) {
    glPushName(name);
}

void JNICALL Java_jopengl_GL_glPopName
  (JNIEnv *env, jclass clz) {
    glPopName();
}

jintArray JNICALL Java_jopengl_GL_glGenTextures
  (JNIEnv *env, jclass clz, jint n) {
    jintArray v = env->NewIntArray(n);
    guiv(v, iv);
    glGenTextures(n, iv);
    env->SetIntArrayRegion(v, 0, n, (jint*)iv);
    riv(v, iv);
    return v;
}

void JNICALL Java_jopengl_GL_glDeleteTextures
  (JNIEnv *env, jclass clz, jint n, jintArray textures) {
    guiv(textures, iv);
    glDeleteTextures(n, iv);
    riv(textures, iv);
}

void JNICALL Java_jopengl_GL_glBindTexture
  (JNIEnv *env, jclass clz, jint target, jint texture) {
    glBindTexture(target, texture);
}

void JNICALL Java_jopengl_GL_glPrioritizeTextures
  (JNIEnv *env, jclass clz, jint n, jintArray textures, jfloatArray priorities) {
    guiv(textures, iv);
    gfv(priorities, fv);
    glPrioritizeTextures(n, iv, fv);
    riv(textures, iv);
    rfv(priorities, fv);
}

jboolean JNICALL Java_jopengl_GL_glAreTexturesResident
  (JNIEnv *env, jclass clz, jint n, jintArray textures, jbooleanArray residences) {
    guiv(textures, iv);
    gzv(residences, zv);
    jboolean r = glAreTexturesResident(n, iv, zv);
    riv(textures, iv);
    rzv(residences, zv);
    return r;
}

jboolean JNICALL Java_jopengl_GL_glIsTexture
  (JNIEnv *env, jclass clz, jint texture) {
    return glIsTexture(texture);
}

void JNICALL Java_jopengl_GL_glTexSubImage1D__IIIII_3B
  (JNIEnv *env, jclass clz, jint target, jint level, jint xoffset, jint width, jint format, jbyteArray pixels) {
    gubv(pixels, bv);
    glTexSubImage1D(target, level, xoffset, width, format, GL_UNSIGNED_BYTE, bv);
    rbv(pixels, bv);
}

void JNICALL Java_jopengl_GL_glTexSubImage1D__IIIIIIJ
  (JNIEnv *env, jclass clz, jint target, jint level, jint xoffset, jint width, jint format, jint type, jlong pixelsAddr) {
    glTexSubImage1D(target, level, xoffset, width, format, type, (GLvoid*)pixelsAddr);
}

void JNICALL Java_jopengl_GL_glTexSubImage2D__IIIIIII_3B
  (JNIEnv *env, jclass clz, jint target, jint level, jint xoffset, jint yoffset, jint width, jint height, jint format, jbyteArray pixels) {
    gubv(pixels, bv);
    glTexSubImage2D(target, level, xoffset, yoffset, width, height, format, GL_UNSIGNED_BYTE, bv);
    rbv(pixels, bv);
}

void JNICALL Java_jopengl_GL_glTexSubImage2D__IIIIIIIIJ
  (JNIEnv *env, jclass clz, jint target, jint level, jint xoffset, jint yoffset, jint width, jint height, jint format, jint type, jlong pixelsAddr) {
    glTexSubImage2D(target, level, xoffset, yoffset, width, height, format, type, (GLvoid*)pixelsAddr);
}

void JNICALL Java_jopengl_GL_glCopyTexImage1D
  (JNIEnv *env, jclass clz, jint target, jint level, jint internalformat, jint x, jint y, jint width, jint border) {
    glCopyTexImage1D(target, level, internalformat, x, y, width, border);
}

void JNICALL Java_jopengl_GL_glCopyTexImage2D
  (JNIEnv *env, jclass clz, jint target, jint level, jint internalformat, jint x, jint y, jint width, jint height, jint border) {
    glCopyTexImage2D(target, level, internalformat, x, y, width, height, border);
}

void JNICALL Java_jopengl_GL_glCopyTexSubImage1D
  (JNIEnv *env, jclass clz, jint target, jint level, jint xoffset, jint x, jint y, jint width) {
    glCopyTexSubImage1D(target, level, xoffset, x, y, width);
}

void JNICALL Java_jopengl_GL_glCopyTexSubImage2D
  (JNIEnv *env, jclass clz, jint target, jint level, jint xoffset, jint yoffset, jint x, jint y, jint width, jint height) {
    glCopyTexSubImage2D(target, level, xoffset, yoffset, x, y, width, height);
}


